﻿<Window x:Class="Clock.Windows.Sense4FlipClock"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:Controls="clr-namespace:Clock.Controls"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Properties="clr-namespace:Clock.Properties"
        x:Name="this" Width="500" Height="200"
        FontFamily="/Home.Base;component/Fonts/#Droid Sans Mono" FontWeight="Light" Background="Transparent" WindowStyle="None" ResizeMode="NoResize" AllowsTransparency="True"
        SourceInitialized="WindowSourceInitialized" Loaded="WindowLoaded" MouseMove="WindowMouseMove" MouseLeftButtonUp="WindowMouseLeftButtonUp" MouseEnter="ThisMouseEnter"
        MouseLeave="ThisMouseLeave">
    <Window.RenderTransform>
        <ScaleTransform x:Name="Scale" ScaleX="1" ScaleY="{Binding ElementName=Scale, Path=ScaleX}"/>
    </Window.RenderTransform>
    <Window.Resources>
        <Storyboard x:Key="ShowForecastAnim" Completed="ShowForecastAnimCompleted">
            <DoubleAnimation Storyboard.TargetName="this" Storyboard.TargetProperty="Height" To="275" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3" FillBehavior="Stop"/>
            <DoubleAnimation Storyboard.TargetName="ForecastGrid" Storyboard.TargetProperty="Height" To="60" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3"/>
            <DoubleAnimation Storyboard.TargetName="ForecastGrid" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3"/>
        </Storyboard>
        <Storyboard x:Key="HideForecastAnim" Completed="HideForecastAnimCompleted">
            <DoubleAnimation Storyboard.TargetName="this" Storyboard.TargetProperty="Height" To="200" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3" FillBehavior="Stop"/>
            <DoubleAnimation Storyboard.TargetName="ForecastGrid" Storyboard.TargetProperty="Height" To="0" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3"/>
            <DoubleAnimation Storyboard.TargetName="ForecastGrid" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.3" AccelerationRatio="0.3" DecelerationRatio="0.3"/>
        </Storyboard>
        <Storyboard x:Key="MouseEnter">
            <DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.3" FillBehavior="Stop" Completed="MouseEnterCompleted"/>
        </Storyboard>
        <Storyboard x:Key="MouseLeave">
            <DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:0.3" FillBehavior="Stop" Completed="MouseLeaveCompleted"/>
        </Storyboard>
    </Window.Resources>
    <Window.ContextMenu>
        <ContextMenu Opened="ContextMenuOpened">
            <MenuItem Name="DemoItem" Header="Demo" Visibility="Collapsed">
                <MenuItem Name="CloudsItem" Header="Clouds" Click="CloudsItemClick"/>
                <MenuItem Name="LightningItem" Header="Lightning" Click="LightningItemClick"/>
                <MenuItem Name="SnowItem" Header="Snow" Click="SnowItemClick"/>
                <MenuItem Name="RainItem" Header="Rain" Click="RainItemClick"/>
            </MenuItem>
            <MenuItem Name="RefreshItem" Header="{x:Static Properties:Resources.Refresh}" Click="RefreshItemClick"/>
            <MenuItem Name="ForecastItem" Header="{x:Static Properties:Resources.ShowForecast}" IsCheckable="True" Click="ForecastItemClick"/>
            <Separator />
            <MenuItem Name="PinItem" Header="{x:Static Properties:Resources.Pin}" IsCheckable="True" Click="PinItemClick"/>
            <MenuItem Name="TopMostItem" Header="{x:Static Properties:Resources.TopMost}" IsCheckable="True" Click="TopMostItemClick"/>
            <MenuItem Name="OptionsItem" Header="{x:Static Properties:Resources.OptionsItem}" Click="OptionsItemClick"/>
            <MenuItem Name="CloseItem" Header="{x:Static Properties:Resources.CloseItem}" Click="CloseItemClick"/>
        </ContextMenu>
    </Window.ContextMenu>
    <Window.TaskbarItemInfo>
        <TaskbarItemInfo x:Name="Taskbar"/>
    </Window.TaskbarItemInfo>
    <Grid Margin="100,15,100,0" Background="#01000000">
        <Image Name="Bg" Source="/Clock;component/Resources/FlipClock/base_default.png" Stretch="Fill" Visibility="Collapsed"/>
        <Rectangle Name="LightningBg1" Opacity="0" Fill="White" RadiusX="12" RadiusY="12" Margin="1,0,1,0"/>
        <Rectangle Name="LightningBg2" Opacity="0" Fill="White" RadiusX="12" RadiusY="12" Margin="1,0,1,0"/>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,-16,0,0">
            <Controls:Sense4FlipTab x:Name="HoursTab" Delay="0.3" Margin="0,0,10,0"/>
            <Controls:Sense4FlipTab x:Name="MinutesTab" Delay="0.2" Speed="0.7"/>
        </StackPanel>
        <Image Source="/Resources/Sense4FlipClock/Background/weather_bg.png" VerticalAlignment="Top" Margin="0,120,0,0"/>
        <TextBlock Name="SetupLocationTextBlock" Foreground="White" Text="{x:Static Properties:Resources.SetupLocation}"  Margin="7,137,7,0" FontSize="14" TextWrapping="WrapWithOverflow" Visibility="Collapsed"/>
        <Grid Name="WeatherGrid">
            <StackPanel Name="WeatherStackPanel" Orientation="Vertical" Margin="7,123,0,0" HorizontalAlignment="Left">
                <StackPanel.Effect>
                    <DropShadowEffect Direction="135" ShadowDepth="1" BlurRadius="2" Opacity="0.6"/>
                </StackPanel.Effect>
                <TextBlock Name="DateTextBlock" Foreground="White" Text="Вт, 22 мар" FontSize="12" Margin="0,0,0,7" HorizontalAlignment="Left" FontWeight="Normal"/>
                <TextBlock Name="LocationTextBlock" Foreground="White" Text="New York" FontSize="16" TextWrapping="NoWrap" MaxWidth="150" Margin="0,-8,0,0" TextTrimming="CharacterEllipsis" FontWeight="Normal"/>
                <TextBlock Name="WeatherTextBlock" Foreground="White" Text="Cloudy" FontSize="13" MaxWidth="100" MaxHeight="30" Margin="0,0,0,0" TextWrapping="NoWrap" FontWeight="Normal" HorizontalAlignment="Left"/>
            </StackPanel>
            <StackPanel HorizontalAlignment="Right" Orientation="Vertical" Margin="0,125,7,0">
                <Grid Name="RightGrid">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition />
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <Grid.Effect>
                        <DropShadowEffect Direction="315" ShadowDepth="1" BlurRadius="2" />
                    </Grid.Effect>
                    <TextBlock Name="TempTextBlock" Grid.Row="1" Grid.RowSpan="2" Foreground="White" Text="1°" FontSize="34" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="-15,-4,0,0"/>
                    <TextBlock Name="HighTempValueTextBlock" Grid.Row="1" Grid.Column="1" Foreground="White" Text="{x:Static Properties:Resources.High}" FontSize="12" Margin="5,0,5,0"/>
                    <TextBlock Name="HighTempTextBlock" Grid.Row="1" Grid.Column="2" Foreground="White" Text="1°" FontSize="12" HorizontalAlignment="Right" Margin="0,0,0,0"/>
                    <TextBlock Name="LowTempValueTextBlock" Grid.Row="2" Grid.Column="1" Foreground="White" Text="{x:Static Properties:Resources.Low}" FontSize="12" Margin="5,-2,5,2"/>
                    <TextBlock Name="LowTempTextBlock" Grid.Row="2" Grid.Column="2" Foreground="White" Text="-6°" FontSize="12" Margin="0,-2,0,2" HorizontalAlignment="Right"/>
                </Grid>
                <StackPanel Name="WindSpeedPanel" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,-3,0,0" Visibility="Collapsed">
                    <Image Name="WindSpeedIcon" Source="/UIFramework.Weather;Component/Images/wind_lvl1.png" Width="42" Height="36" Margin="0,-10,-1,0" RenderOptions.BitmapScalingMode="HighQuality" Stretch="Fill"/>
                    <TextBlock Name="WindSpeedValueTextBlock" Foreground="White" Text="25 mph" FontSize="12">
                        <TextBlock.Effect>
                            <DropShadowEffect Direction="315" ShadowDepth="1" BlurRadius="2" />
                        </TextBlock.Effect>
                    </TextBlock>
                </StackPanel>
                <StackPanel Name="HumidityPanel" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,-3,0,0" Visibility="Collapsed">
                    <Image Name="HumidityIcon" Source="/UIFramework.Weather;Component/Images/humidity_lvl1.png" Width="16" Height="16" Margin="0,-10,3,-10" RenderOptions.BitmapScalingMode="HighQuality"/>
                    <TextBlock Name="HumidityValueTextBlock" Foreground="White" Text="75%" FontSize="12">
                        <TextBlock.Effect>
                            <DropShadowEffect Direction="315" ShadowDepth="1" BlurRadius="2" />
                        </TextBlock.Effect>
                    </TextBlock>
                </StackPanel>
            </StackPanel>
            <Image Name="WeatherIcon" Width="110" Height="110" Source="/UIFramework.Weather;Component/Images/weather_1.png"
                   ToolTip="{x:Static Properties:Resources.ShowForecastTooltip}" Cursor="Hand" VerticalAlignment="Top" Margin="0,60,0,0"
                   MouseLeftButtonDown="WeatherIconMouseLeftButtonDown" MouseLeftButtonUp="WeatherIconMouseLeftButtonUp"/>
            <ProgressBar Name="WeatherRefreshProgressBar" Height="30" VerticalAlignment="Bottom" IsIndeterminate="True" Style="{StaticResource WeatherRefreshProgressBarStyle}" Foreground="White" Visibility="Collapsed">
                <ProgressBar.OpacityMask>
                    <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
                        <GradientStop Color="#00000000" Offset="0"/>
                        <GradientStop Color="#00000000" Offset="0.3"/>
                        <GradientStop Color="#FF000000" Offset="0.5"/>
                        <GradientStop Color="#00000000" Offset="0.7"/>
                        <GradientStop Color="#00000000" Offset="1"/>
                    </LinearGradientBrush>
                </ProgressBar.OpacityMask>
            </ProgressBar>
        </Grid>
        <Grid Name="ForecastGrid" Opacity="0" Height="0" VerticalAlignment="Bottom" ClipToBounds="True" Margin="2,0,2,10">
            <Image Source="/Resources/Sense4FlipClock/Background/weather_bg.png" Stretch="Uniform"/>
            <Grid Name="ForecastPanel" SnapsToDevicePixels="False">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="1"/>
                    <ColumnDefinition />
                    <ColumnDefinition Width="1"/>
                    <ColumnDefinition />
                    <ColumnDefinition Width="1"/>
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Controls:ForecastItem Cursor="Hand" Order="1" IconHeight="30" IconMargin="3,0,3,3"/>
                <Rectangle Grid.Column="1" Fill="#5e5e5e" Width="1" Opacity="0.8" Margin="0,3,0,4"/>
                <Controls:ForecastItem Grid.Column="2" Cursor="Hand" Order="3" IconHeight="30" IconMargin="3,0,3,3"/>
                <Rectangle Grid.Column="3" Fill="#878787" Width="1" Opacity="0.6" Margin="0,3,0,4"/>
                <Controls:ForecastItem Grid.Column="4" Cursor="Hand" Order="0" IconHeight="30" IconMargin="3,0,3,3"/>
                <Rectangle Grid.Column="5" Fill="#5e5e5e" Width="1" Opacity="0.8" Margin="0,3,0,4"/>
                <Controls:ForecastItem Grid.Column="6" Cursor="Hand" Order="2" IconHeight="30" IconMargin="3,0,3,3"/>
            </Grid>
        </Grid>
        <Canvas Name="WeatherFxHost" Margin="-100,0,-100,0" IsHitTestVisible="False"/>
    </Grid>
</Window>
